﻿using UnityEngine;

namespace winS.Unity
{
    /// <summary>
    /// 提供位置跟随的功能
    /// </summary>
    [AddComponentMenu("winS/Position Follower")]
    public class PositionFollower : MonoBehaviour
    {
        public Vector3 offset;

        /// <summary>
        /// 跟随目标
        /// </summary>
        public Transform target;

        private void Update()
        {
            if (!target) return;
            transform.position = target.position + offset;
        }
    }
}